package com.fosung.frame.tsdemo.front.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fosung.frame.modules.cms.entity.Category;
import com.fosung.frame.modules.sys.entity.User;
import com.fosung.frame.tsdemo.entity.meeting.Meeting;
import com.fosung.frame.tsdemo.entity.module.Module;
import com.fosung.frame.tsdemo.entity.notice.Notice;
import com.fosung.frame.tsdemo.entity.rulemodule.RuleModule;
import com.fosung.frame.tsdemo.front.dao.AppDao;
import com.fosung.frame.tsdemo.front.service.AppService;
@Service
@Transactional(readOnly = true)
public class AppServiceImpl implements AppService {

	@Autowired
	private AppDao dao;
	/**
	 * 查询用户
	 */
	@Override
	public User getUserByName(String loginName) {
		// TODO Auto-generated method stub
		return dao.getUserByName(loginName);
	}
	/**
	 * 根据类型选择是底部菜单，还是顶部菜单
	 */
	@Override
	public List<Category> findCategoryList(String module) {
		// TODO Auto-generated method stub 
		return dao.findCategoryList(module);
	}
	/**
	 * 根据栏目ID获取栏目下面的通知信息
	 */
	@Override
	public List<Notice> findNoticeList(String categoryId,String type,String userId) {
		// TODO Auto-generated method stub
		if("1".equals(type)){//banner页只显示5条
			return dao.findNoticeBanner(categoryId,userId);
		}else{//全部显示
			return dao.findNoticeList(categoryId,userId);
		}
	}
	/**
	 * 查询下级栏目
	 */
	@Override
	public List<Category> queryCategoryList(String categoryId) {
		// TODO Auto-generated method stub
		return dao.queryCategoryList(categoryId);
	}
	/**
	 *	查询出模块列表
	 */
	@Override
	public List<Module> queryModuleList(String userId) {
		// TODO Auto-generated method stub
		return dao.queryModuleList(userId);
	}
	/**
	 * 查询出用户的权限
	 */
	@Override
	public RuleModule getRuleModuleByUserId(String userId) {
		// TODO Auto-generated method stub
		return dao.getRuleModuleByUserId(userId);
	}
	/**
	 * 查询出党建热点的列表信息
	 */
	@Override
	public List<Meeting> findMeetingList(String categoryId, String userId) {
		// TODO Auto-generated method stub
		return dao.findMeetingList(categoryId, userId);
	}

}
